package org.lh.controller;

import com.google.gson.Gson;
import org.lh.annotation.AutoWired;
import org.lh.annotation.RequestMapping;
import org.lh.annotation.RestController;
import org.lh.model.User;
import org.lh.service.UserService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

/**
 * 作者：idea
 * 日期：2018/7/18
 * 描述：
 */
@RestController(value = "rest")
public class RestApi {

    @AutoWired(value = "UserService")
    UserService us;





    @RequestMapping(value = "/test")
    public String test(HttpServletRequest request, HttpServletResponse response){
        us.init();
        return "this is a test";
    }

    @RequestMapping(value = "/json")
    public List<User> list(HttpServletRequest request, HttpServletResponse response){
        List<User> userList=new ArrayList<User>();
        for(int i=0;i<10;i++){
            User user=new User("id","name","pwd");
            userList.add(user);
        }
        return userList;
    }


}
